package com.martinwj.camera2demo.ui;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.Button;

import androidx.annotation.Nullable;

@SuppressLint("AppCompatCustomView")
public class CaptureView extends Button {

    private Paint mPaint1,mPaint2,mPaint3;
    private int width,height;
    public CaptureView(Context context) {
        super(context);
        init();
    }

    public CaptureView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CaptureView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        mPaint1=new Paint();
        mPaint1.setColor(Color.GRAY);
        mPaint1.setStyle(Paint.Style.FILL);
        mPaint1.setStrokeWidth(4f);
        mPaint2=new Paint();
        mPaint2.setColor(Color.BLACK);
        mPaint2.setStyle(Paint.Style.STROKE);
        mPaint2.setStrokeWidth(4f);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        width = getMeasuredWidth();
        height = getMeasuredHeight();
        canvas.drawCircle(width / 2, height / 2,45f, mPaint1);
        canvas.drawCircle(width/2,height/2,60f,mPaint2);
    }
}
